<% if user_signed_in? && current_user.admin? %>
<div id="navbar">
  <div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
      <div class="container clearfix">
      <ul class="nav pull-left">

         <% if current_page?(root_path) %>
           <li>
             <a href="<%= url_for admin_homepage_path %>"><i class="icon-edit icon-white"></i> Edit homepage</a>
           </li>
           <li>
              <a href="<%= url_for new_admin_campaign_path %>"><i class="icon-plus icon-white"></i> New Campaign</a>
           </li>
         <% end %>

         <% if request.fullpath.include? 'admin' %>
           <li>
             <a href="<%= url_for root_path %>"><i class="icon-chevron-left icon-white"></i> Back to website</a>
           </li>
           <li>
              <a href="<%= url_for new_admin_campaign_path %>"><i class="icon-plus icon-white"></i> New Campaign</a>
           </li>
         <% end %>

         <% if params[:controller] == 'campaigns' %>
           <li>
             <a href="<%= edit_admin_campaign_path(@campaign) %>"><i class="icon-edit icon-white"></i> Edit campaign</a>
           </li>

           <li>
             <a href="<%= admin_campaigns_payments_path(@campaign) %>"><i class="icon-list icon-white"></i> View payments</a>
           </li>

           <% if !@campaign.published_flag %>
             <li class="status red show_tooltip" data-placement="bottom" data-title="Visible to ADMINS ONLY">
               Not published
             </li>
           <% else %>
             <li class="status green show_tooltip" data-placement="bottom" data-title="Visible to ALL">
               Published
             </li>
           <% end %>

           <% if !@campaign.production_flag %>
             <li class="status red show_tooltip" data-placement="bottom" data-title="Transactions WILL NOT be processed">
               Sandbox payments
             </li>
           <% else %>
             <li class="status green show_tooltip" data-placement="bottom" data-title="Transactions WILL be processed">
               Payments activated
             </li>
           <% end %>

         <% end %>

       </ul>

        <ul class="nav pull-right">
            <li class="dropdown">
              <%= image_tag 'user_icon.png' %>
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                <%= current_user.fullname %> <b class="caret"></b>
              </a>
              <ul class="dropdown-menu pull-right" role="menu">
                <li><%= link_to "Account", edit_user_registration_path %></li>
                <li><%= link_to "Admin", admin_dashboard_path %></li>
                <li class="divider"></li>
                <li><%= link_to "Sign Out", destroy_user_session_path, method: "delete" %></li>
              </ul>
          </li>
        </ul>
      </div>
    </div>
  </div>
  <div class="spacer" style="height:30px; width: 100%"></div>
</div>
<% end %>
